interface QueryDurationItem {
  end: string;
  start: string;
  step: string;
}

export interface ServiceParam {
  duration?: QueryDurationItem;
  keyword?: string;
}
export interface ServiceItem {
  key: string;
  label: string;
}
export interface EndpointParam {
  keyword: string;
  limit: number;
  serviceId: string;
}

export interface EndpointItem {
  key: string;
  label: string;
}

export interface CreateParam {
  dumpPeriod: number;
  duration: number;
  endpointName: string;
  maxSamplingCount: number;
  minDurationThreshold: number;
  serviceId: string;
  startTime: number;
}
export interface TaskParam {
  endpointName: string;
  serviceId: string;
}

export interface LogItem {
  id: string;
  instanceId: string;
  instanceName: string;
  operationTime: number;
  operationType: string;
  timeStr: string;
}
export interface TaskItem {
  dumpPeriod: number;
  duration: number;
  endpointName: string;
  id: string;
  logs: LogItem[];
  maxSamplingCount: number;
  minDurationThreshold: number;
  serviceId: string;
  serviceName: string;
  startTime: number;
  startStr: string;
}

export interface SampleItem {
  duration: number;
  endpointNames: string[];
  isError: boolean;
  segmentId: string;
  start: string;
  traceIds: string[];
  startStr: string;
  serviceName: string;
}

interface TagItem {
  key: string;
  value: string;
}

interface SampleLog {
  data: TagItem[];
  time: number;
}

export interface SampleTableItem {
  component: string;
  endTime: number;
  endpointName: string;
  isError: boolean;
  layer: string;
  logs: SampleLog[];
  parentSpanId: number;
  peer: string;
  serviceCode: string;
  serviceInstanceName: string;
  spanId: number;
  startTime: number;
  tags: TagItem[];
  type: string;
  duration: number;
  durationRate: number;
  startStr: string;
  children?: SampleTableItem[];
}

interface TimeRange {
  end: number;
  start: number;
}
export interface AnalyzeParams {
  segmentId: string;
  timeRanges: TimeRange[];
}

export interface Children {
  codeSignature: string;
  count: number;
  duration: number;
  durationChildExcluded: number;
  id: string;
  parentId: string;
  children?: Children[];
}
export interface Tree {
  elements: Children[];
}
export interface AnalyzeItem {
  tip: string;
  trees: Tree[];
}
